<template>
    <div id="seachDialog">
      <a-modal
      title="快速筛选"
      width="550px"
      :visible="searchData.show"
      @cancel="handleClose">
        <el-row style="padding:30px 70px 50px 20px;overflow-y:auto;height:580px;overflow-x:hidden;">
            <el-form :model="searchParames" ref="searchParames" label-width="120px">
                <el-form-item label="服务商名称:">
                    <el-input clearable size="small" v-model="searchParames.customerName" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="简称:">
                    <el-input clearable size="small" v-model="searchParames.shortName" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="联系人姓名:">
                    <el-input clearable size="small" v-model="searchParames.contactName" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="联系人手机:">
                    <el-input clearable size="small" v-model="searchParames.contactMobile" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="业务咨询电话:">
                    <el-input clearable size="small" v-model="searchParames.consultingTelephone" placeholder="请输入"></el-input>
                </el-form-item>
            </el-form>
        </el-row>
        <span slot="footer" class="dialog-footer">
            <el-button size="small" @click="handleReset">重置</el-button>
            <el-button size="small" type="primary" @click="handleSend">查询</el-button>
        </span>
      </a-modal>
    </div>
</template>

<script>
export default {
    props: ['searchData'],
    data() {
        return {
          searchParames: {
            providerName: '',//服务商名称
            shortName: '',//简称
            contactName: '',//联系人姓名
            contactMobile: '',//联系人手机
            consultingTelephone: '',//业务咨询电话
          },
        };
    },
    methods: {
        handleSend () {
            let searchDate = []
            for(var key in this.searchParames){
                if (this.searchParames[key]) {
                    searchDate.push({
                        key: key,
                        value: this.searchParames[key],
                        type: 'string'
                    })
                }
            }
            this.$emit('checkSearch',searchDate)
            this.handleClose()
        },
        handleClose () {
            this.searchData.show = false
        },
        handleReset () {
            this.searchParames.providerName = ''
            this.searchParames.shortName = ''
            this.searchParames.contactName = ''
            this.searchParames.contactMobile = ''
            this.searchParames.consultingTelephone = ''
            this.$emit('resetSearch')
            this.$refs.searchParames.resetFields()
        }
    },
    computed: {
      changeDialog () {
        return this.searchData.show
      }
    }, 
    watch: {
      changeDialog: {
        handler (curVal, oldVal) {
          if (curVal) {
            this.searchParames.providerName = this.searchData.providerName
          } else {
          }
        }
      }
    },
};
</script>

<style>
#seachDialog .el-dialog{
    padding-bottom: 0; 
    overflow-x: hidden;
}
#seachDialog .el-dialog__footer{
    border-top: #f4f4f4 solid 1px;
}
.ant-modal-body{
    padding: 0
}
</style>
